<?php
include_once("config/config.php");
include_once(CLASS_PATH."logic.php");
include_once(CLASS_PATH."Template.php");
////////////////////////////////////////////////////////////
$Json_Data = "null";
$sitehtml = "top.html";
$is_toppage = "true";
$data = $_GET;
$get_site_value =_GET("site");
$get_type_value =_GET("type");
$get_q_value =_GET("q");
$get_p_value =_GET("p");
$get_s_value =_GET("s");
if(empty($get_site_value)||empty($get_type_value)){
	$data = array(
		"site"=> "yahoo,bidders",
		"type"=> "auction"
		);
}

$fjsearch = new logic($data);
if(!empty($get_site_value)&&!empty($get_type_value)&&!empty($get_q_value)){
	$sitehtml = "search.html";
	$is_toppage = "false";
	$Json_Data = $fjsearch->Output(_GET("op"));
}
$show = _GET("Show");

if($show!="s"&&$show!="b"){$show="s";}
$repstr = array(
	"##JSONDATA#"	=> $Json_Data,
	"##B_S#"		=> empty($show)?"s":$show,
	"##HOTKEY#"		=> $fjsearch->Output("hotkey"),
	"##CATEGORYLIST#"	=> $fjsearch->Output("category"),
	//"##SORTORDER#"	=> $fjsearch->Output("sortorder"),
	"##INTERFACE#"	=> str_replace("\\/","/",$fjsearch->Output("interface")),
	"##OLDKEYWORD#"	=> _GET("q"),
	"##MINPRICE#"	=> _GET("Minprice"),
	"##MAXPRICE#"	=> _GET("Maxprice"),
	"##CATEGORY_VALUE#"	=> _GET("c"),
	"##SITE#"		=> _GET("site"),
	"##TYPE#"		=> _GET("type"),
	"##PAGENUM#"	=> empty($get_p_value)?0:$get_p_value,
	"##LANG#"	=> LANG,
	"##NOW_SORT#"	=> empty($get_s_value)?"end,A":$get_s_value,
	"##AUCTION_YAHOO_STORE#"	=> _GET("store"),
	"##AUCTION_YAHOO_NEW#"	=> _GET("item_status"),
	"##AUCTION_YAHOO_BUYNOW#"	=> _GET("buynow"),
	"##SHOPPING_YAHOO_GIFT#"	=> _GET("gift_icon"),
	"##AUCTION_YAHOO_LOC#"	=> _GET("loc_cd"),//地域
	"##SHOPPING_YAHOO_AVAILA#"	=> _GET("availability"),
	"##SHOPPING_R_IMG#"	=> _GET("imageFlag"),
	"##ISTOPPAGE#" => $is_toppage,
	);

$template = new Template();
$template->Out($sitehtml,$repstr);
//include_once(HTML_PATH."top.html");
?>